<?php TPL::output('admin/global/header.tpl.htm'); ?>
<?php TPL::output('admin/global/nav_menu.tpl.htm'); ?>

<div class="aw-content-wrap">
	<div class="mod">
		<div class="mod-head">
			<h3>
				<span class="pull-left"><?php _e('积分日志'); ?>: <?php echo $this->user['user_name']; ?></span>
			</h3>
		</div>
		<div class="mod-body tab-content">
			<table class="table table-striped">
				<thead>
					<tr>
			        	<th width="15%"><?php _e('时间'); ?></th>
			        	<th width="5%"><?php _e('方向'); ?></th>
			            <th width="8%"><?php _e('数额'); ?></th>
			            <th width="8%"><?php _e('余额'); ?></th>
			            <th width="24%"><?php _e('描述'); ?></th>
			            <th width="40%"><?php _e('相关信息'); ?></th>
					</tr>
				</thead>
				<tbody>
					<?php if ($this->integral_log) { ?>
					<?php foreach ($this->integral_log AS $key => $val) { ?>
					<tr>
						<td><?php echo date_friendly($val['time']); ?></td>
						<td><?php if ($val['integral'] > 0) { ?><?php _e('收入'); ?><?php } else { ?><?php _e('支出'); ?><?php } ?></td>
						<td><span style="color:<?php if ($val['integral'] > 0) { ?>#F5A900<?php } ?>"><?php echo $val['integral']; ?></span></td>
						<td><?php echo $val['balance']; ?></td>
						<td><?php _e($val['note']) ;?></td>
						<td><?php if ($this->integral_log_detail[$val['id']]) { ?><a href="<?php echo $this->integral_log_detail[$val['id']]['url']; ?>" target="_blank"><?php echo $this->integral_log_detail[$val['id']]['title']; ?></a><?php } else { ?> - <?php } ?></td>
					</tr>
					<?php } ?>
					<?php } ?>
				</tbody>
			</table>
			<div class="mod-table-foot">
			    <form id="integral_form" action="admin/ajax/integral_process/" method="post" onsubmit="return false">
				<input name="uid" type="hidden" value="<?php echo $this->user['uid']; ?>">
			        <div class="col-sm-10 col-md-2 clearfix">
			            <div class="form-group">
			                <span class="col-sm-6 mod-category-foot"><?php _e('当前积分'); ?>:</span>
			                <span class="col-sm-6 "><?php echo $this->user['integral']; ?></span>
			            </div>
			        </div>
			        <div class="col-sm-12 col-md-3">
			            <div class="form-group">
			                <span class="col-sm-4 mod-category-foot"><?php _e('操作积分') ?>:</span>
			                <div class="col-sm-8 col-xs-12">
			                    <input type="text" class="form-control" name="integral" />
			                </div>
			            </div>
			        </div>
			        <div class="col-sm-10 col-md-3">
			            <div class="form-group">
			                <span class="col-sm-3 mod-category-foot"><?php _e('说明') ?>:</span>
			                <div class="col-sm-9 col-xs-12">
			                    <input type="text" class="form-control" name="note" value="<?php _e('管理员操作积分'); ?>" />
			                </div>
			            </div>
			        </div>
			        <div class="col-sm-10 col-md-4">
			            <a onclick="AWS.ajax_post($('#integral_form'));" class="btn-primary btn"><?php _e('提交'); ?></a>
			            <div class="pull-right"><?php echo $this->pagination; ?></div>
			        </div>
			    </form>
			    </div>
		</div>
	</div>
</div>

<?php TPL::output('admin/global/footer.tpl.htm'); ?>